#include <stdio.h>
#include <math.h>

typedef double ptype;
#define EPSILON 1.0e-15

typedef struct { ptype x, y, z; } Point;

typedef Point Rational;
typedef Point Line;

ptype ptypeabs(ptype x) {
	return x >= 0 ? x : -x;
}

#if 0
ptype ptypegcd(ptype x, ptype y)
{
	ptype t;
	x = ptypeabs(x), y = ptypeabs(y);

	while(y>0)
	{
		t = x % y;
		x = y;
		y = t;
	}

	return x;
}
#endif

Point mk_point(ptype x, ptype y, ptype z)
{
	Point t;
	t.x = x, t.y = y, t.z = z;
	return t;
}

Point reduce(const Point &t)
{
	if(t.x == 0 && t.y == 0 && t.z == 0)
		return t;

#if 0
	ptype r = ptypegcd(ptypegcd(t.x, t.y), t.z);
#endif
   ptype r = (t.z == 0 || ptypeabs(t.x/t.z) > 1.0/EPSILON) ? ptypeabs(t.x) + ptypeabs(t.y) : ptypeabs(t.z);

	if(t.z < 0)
		r = -r;

	return mk_point(t.x / r, t.y / r, t.z / r);
}

Point cross(const Point &t, const Point &u)
{
	return reduce(mk_point(t.y*u.z - t.z*u.y, t.z*u.x - t.x*u.z, t.x*u.y - t.y*u.x));
}

ptype full_dot(const Point &t, const Point &u)
{
	return t.x*u.x + t.y*u.y + t.z*u.z;
}

Point vec_sub(const Point &t, const Point &u)
{
	return reduce(mk_point(t.x*u.z - u.x*t.z, t.y*u.z - u.y*t.z, t.z*u.z));
}

Point scalar_mult(const Point &t, const Rational &k)
{
	return reduce(mk_point(t.x*k.x, t.y*k.x, t.z*k.z));
}

Rational cart_dot(const Point &t, const Point &u)
{
	return reduce(mk_point(t.x*u.x + t.y*u.y, 0, t.z * u.z));
}

Rational norm(const Point &t)
{
	return cart_dot(t,t);
}

int compare_ratio(const Rational &t, const Rational &u)
{
   if(ptypeabs(t.z) < EPSILON)
      return 1;
   if(ptypeabs(u.z) < EPSILON)
      return -1;
   
   ptype a = t.x * u.z  - t.z * u.x;
   return a > 0 ? 1 : a < 0 ? -1 : 0;
}

Point parallel_line(Point a, Line l)
{
	l.z = l.z*a.z - full_dot(a,l);
	l.x *= a.z, l.y *= a.z;
	return reduce(l);
}

Point perp_line(Point a, Point l)
{
	ptype t = l.x;
	l.x = l.y, l.y = -t;
	return parallel_line(a,l);
}

Line reflect(Line a, Line b)
// Line b reflected in line a
{
	ptype t = 2 * (a.x*b.x + a.y*b.y);
	ptype u = a.x*a.x + a.y*a.y;

	return reduce(mk_point(b.x * u - a.x * t, b.y * u - a.y * t, b.z * u - a.z * t));
}

void print_point(const Point &x)
{
	printf("(%lf %lf %lf)\n", x.x, x.y, x.z);
}

Rational dist_attempt(Point o, Point x1, Point y1, Point x2, Point y2)
{
#ifdef DEBUG
	print_point(x1);
	print_point(y1);
	print_point(x2);
	print_point(y2);
#endif
	Line l1 = cross(x1, y1);
	Line l2 = cross(x2, y2);
	Line l3 = reflect(l1, l2);
#ifdef DEBUG
	printf("\n");
	print_point(l1);
	print_point(l2);
	print_point(l3);
#endif

	Point intersect = cross(l1, l2);

	Point perp2 = cross(perp_line(o, l2), l2);
	Point perp3 = cross(perp_line(o, l3), l3);

#ifdef DEBUG
	printf("\n");
	print_point(intersect);
   print_point(perp_line(o, l2));
   print_point(perp_line(o, l3));
	print_point(perp2);
	print_point(perp3);
#endif

	Rational best;
	if(intersect.z != 0)
		best = norm(vec_sub(o, intersect));
	else
		best = mk_point(1,0,0);

	ptype perp2side = full_dot(l1, perp2);
	ptype perp3side = full_dot(l1, perp3);
	ptype oside = full_dot(l1, o);
#ifdef DEBUG
	printf("%lf %lf %lf\n", perp2side, perp3side, oside);
#endif

	if(!(perp2side > 0 && oside > 0) && !(perp2side < 0 && oside < 0) && perp2.z != 0)
	{
		Rational d2 = norm(vec_sub(o, perp2));
		if(compare_ratio(d2, best) < 0)
			best = d2;
	}

	if(!(perp3side > 0 && oside > 0) && !(perp3side < 0 && oside < 0) && perp2.z != 0)
	{
		Rational d2 = norm(vec_sub(o, perp3));
		if(compare_ratio(d2, best) < 0)
			best = d2;
	}

	return best;
}

Rational best_dist(Point o, Point x1, Point x2, Point x3, Point x4)
{
	Rational best;
	Rational d2 = dist_attempt(o, x1, x2, x3, x4);

	best = d2;
#ifdef DEBUG
	printf("%lf %lf\n", d2.x, d2.z);
#endif
	
	d2 = dist_attempt(o, x3, x4, x1, x2);
#ifdef DEBUG
	printf("%lf %lf\n", d2.x, d2.z);
#endif
	if(compare_ratio(d2, best) < 0)
		best = d2;

	d2 = dist_attempt(o, x1, x3, x2, x4);
#ifdef DEBUG
	printf("%lf %lf\n", d2.x, d2.z);
#endif
	if(compare_ratio(d2, best) < 0)
		best = d2;

	d2 = dist_attempt(o, x2, x4, x1, x3);
#ifdef DEBUG
	printf("%lf %lf\n", d2.x, d2.z);
#endif
	if(compare_ratio(d2, best) < 0)
		best = d2;

	d2 = dist_attempt(o, x1, x4, x2, x3);
#ifdef DEBUG
	printf("%lf %lf\n", d2.x, d2.z);
#endif
	if(compare_ratio(d2, best) < 0)
		best = d2;

	d2 = dist_attempt(o, x2, x3, x1, x4);
#ifdef DEBUG
	printf("%lf %lf\n", d2.x, d2.z);
#endif
	if(compare_ratio(d2, best) < 0)
		best = d2;

	return best;
}

void get_point(Point &t)
{
	scanf("%lf %lf", &t.x, &t.y);
	t.z = 1;
}

int main()
{
	Point x1, x2, x3, x4;

	get_point(x1);
	get_point(x2);
	get_point(x3);
	get_point(x4);

	Rational r = best_dist(mk_point(0,0,1), x1, x2, x3, x4);
	double a = sqrt((double) r.x / (double) r.z);

	printf("%.10lf\n", a);

	return 0;
}
